home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / System Extras Headers / GX Headers / GXExceptions.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  8.1 KB  |  354 lines  |  [TEXT/MMCC]

  1. /*
  2.     File:        Exceptions.h
  3.  
  4.     Copyright:    © 1984-1994 by Apple Computer, Inc., all rights reserved.
  5.  
  6.     WARNING
  7.     This file was auto generated by the interfacer tool. Modifications
  8.     must be made to the master file.
  9.  
  10. */
  11.  
  12. #ifndef __EXCEPTIONS__
  13. #define __EXCEPTIONS__
  14.  
  15. #ifndef        __TYPES__
  16. #include <Types.h>
  17. /*    #include <ConditionalMacros.h>                                */
  18. /*    #include <MixedMode.h>                                        */
  19. /*        #include <Traps.h>                                        */
  20. #endif
  21.  
  22. #define DEBUGOFF 0
  23.  
  24. #define DEBUGWARN 1
  25.  
  26. #define DEBUGON 2
  27.  
  28. #define DEBUGFULL 3
  29.  
  30. #ifndef DEBUGLEVEL
  31. #define DEBUGLEVEL DEBUGOFF
  32.  
  33. #endif
  34.  
  35. extern void PlaceHolder(void);
  36. #define resumeLabelsOn(exception) resume_##exception:
  37.  
  38. #define resumeLabelsOff(exception)
  39.  
  40. #define resumeLabel(exception)
  41.  
  42. #define SetExceptionOption(option)
  43.  
  44. #define trace "\p;dprintf;doTrace"
  45.  
  46. #define notrace "\p;dprintf;mnop"
  47.  
  48. #define traceon ((DEBUGLEVEL > DEBUGWARN) && defined(TRACEON))
  49.  
  50. #define debugon (DEBUGLEVEL > DEBUGWARN)
  51.  
  52. extern void dprintf(StringPtr traceOption, char theFormat[], ...)
  53.  TWOWORDINLINE(0xABFF, 0x594F);
  54. extern void *check_dprintf(void *assertion, StringPtr traceOption, char theFormat[], ...)
  55.  SIXWORDINLINE(0x201F, 0x6606, 0xABFF, 0x594F, 0x4240, 0x594F);
  56. extern void *checkpos_dprintf(void *assertion, StringPtr traceOption, char theFormat[], ...)
  57.  SIXWORDINLINE(0x201F, 0x6C06, 0xABFF, 0x594F, 0x4240, 0x594F);
  58. #if DEBUGLEVEL==DEBUGON
  59. #define check(assertion)         \
  60.     if (true) {                    \
  61.     if (assertion) ;                \
  62.     else {                            \
  63.     dprintf(notrace, "Assertion \"%s\" Failed",    "assertion");     \
  64.     }                                \
  65.     } else PlaceHolder()
  66.  
  67. #elif DEBUGLEVEL==DEBUGFULL
  68. #define check(assertion)         \
  69.     if (true) {                    \
  70.     if (assertion) ;                \
  71.     else {                            \
  72.     dprintf(notrace,    "Assertion \"%s\" Failed\n"     \
  73.     "File: %s\n"                    \
  74.     "Line: %d",                    \
  75.     "assertion", __FILE__, __LINE__);     \
  76.     }                                \
  77.     } else PlaceHolder()
  78.  
  79. #else
  80. #define check(assertion)
  81.  
  82. #endif
  83.  
  84. #if    DEBUGLEVEL==DEBUGON
  85. #define ncheck(assertion)         \
  86.     if (true) {                    \
  87.     void*    __privateAssertion    = (void*)(assertion);     \
  88.                                 \
  89.     if (__privateAssertion) {        \
  90.     dprintf(notrace, "Assertion \"!(%s [= 0x%08X])\" Failed",     \
  91.     "assertion", __privateAssertion);     \
  92.     }                                \
  93.     } else PlaceHolder()
  94.  
  95. #elif DEBUGLEVEL==DEBUGFULL
  96. #define ncheck(assertion)         \
  97.     if (true) {                    \
  98.     void*    __privateAssertion    = (void*)(assertion);     \
  99.                                 \
  100.     if (__privateAssertion) {        \
  101.     dprintf(notrace,    "Assertion \"!(%s [= 0x%08X])\" Failed\n"     \
  102.     "File: %s\n"                    \
  103.     "Line: %d",                    \
  104.     "assertion", __privateAssertion, __FILE__, __LINE__);     \
  105.     }                                \
  106.     } else PlaceHolder()
  107.  
  108. #else
  109. #define ncheck(assertion)
  110.  
  111. #endif
  112.  
  113. #if DEBUGLEVEL==DEBUGON
  114. #define check_action(assertion, action)  \
  115.     if (true) {                    \
  116.     if (assertion) ;                \
  117.     else {                            \
  118.     dprintf(notrace, "Assertion \"%s\" Failed",    "assertion");     \
  119.     { action }                        \
  120.     }                                \
  121.     } else PlaceHolder()
  122.  
  123. #elif DEBUGLEVEL==DEBUGFULL
  124. #define check_action(assertion, action)  \
  125.     if (true) {                    \
  126.     if (assertion) ;                \
  127.     else {                            \
  128.     dprintf(notrace,    "Assertion \"%s\" Failed\n"     \
  129.     "File: %s\n"                    \
  130.     "Line: %d",                    \
  131.     "assertion", __FILE__, __LINE__);     \
  132.     { action }                        \
  133.     }                                \
  134.     } else PlaceHolder()
  135.  
  136. #else
  137. #define check_action(assertion, action)
  138.  
  139. #endif
  140.  
  141. #if    DEBUGLEVEL==DEBUGON
  142. #define ncheck_action(assertion, action)  \
  143.     if (true) {                    \
  144.     void*    __privateAssertion    = (void*)(assertion);     \
  145.                                 \
  146.     if (__privateAssertion) {        \
  147.     dprintf(notrace, "Assertion \"!(%s [= 0x%08X])\" Failed",     \
  148.     "assertion", __privateAssertion);     \
  149.     { action }                        \
  150.     }                                \
  151.     } else PlaceHolder()
  152.  
  153. #elif DEBUGLEVEL==DEBUGFULL
  154. #define ncheck_action(assertion, action)  \
  155.     if (true) {                    \
  156.     void*    __privateAssertion    = (void*)(assertion);     \
  157.                                 \
  158.     if (__privateAssertion) {        \
  159.     dprintf(notrace,    "Assertion \"!(%s [= 0x%08X])\" Failed\n"     \
  160.     "File: %s\n"                    \
  161.     "Line: %d",                    \
  162.     "assertion", __privateAssertion, __FILE__, __LINE__);     \
  163.     { action }                        \
  164.     }                                \
  165.     } else PlaceHolder()
  166.  
  167. #else
  168. #define ncheck_action(assertion, action)
  169.  
  170. #endif
  171.  
  172. #if DEBUGLEVEL==DEBUGON
  173. #define require(assertion, exception)  \
  174.     if (true) {                    \
  175.     if (assertion) ;                \
  176.     else {                            \
  177.     dprintf(notrace,    "Assertion \"%s\" Failed\n"     \
  178.     "Exception \"%s\" Raised",        \
  179.     "assertion", "exception");        \
  180.     goto exception;                \
  181.     resumeLabel(exception);        \
  182.     }                                \
  183.     } else PlaceHolder()
  184.  
  185. #elif DEBUGLEVEL==DEBUGFULL
  186. #define require(assertion, exception)  \
  187.     if (true) {                    \
  188.     if (assertion) ;                \
  189.     else {                            \
  190.     dprintf(notrace,    "Assertion \"%s\" Failed\n"     \
  191.     "Exception \"%s\" Raised\n"     \
  192.     "File: %s\n"                    \
  193.     "Line: %d",                    \
  194.     "assertion", "exception", __FILE__, __LINE__);     \
  195.     goto exception;                \
  196.     resumeLabel(exception);        \
  197.     }                                \
  198.     } else PlaceHolder()
  199.  
  200. #else
  201. #define require(assertion, exception)  \
  202.     if (true) {                    \
  203.     if (assertion) ;                \
  204.     else {                            \
  205.     goto exception;                \
  206.     resumeLabel(exception);        \
  207.     }                                \
  208.     } else PlaceHolder()
  209.  
  210. #endif
  211.  
  212. #if DEBUGLEVEL==DEBUGON
  213. #define nrequire(assertion, exception)  \
  214.     if (true) {                    \
  215.     void*    __privateAssertion    = (void*)(assertion);     \
  216.                                 \
  217.     if (__privateAssertion) {        \
  218.     dprintf(notrace,    "Assertion \"!(%s [= 0x%08X])\" Failed\n"     \
  219.     "Exception \"%s\" Raised",        \
  220.     "assertion", __privateAssertion, "exception");     \
  221.     goto exception;                \
  222.     resumeLabel(exception);        \
  223.     }                                \
  224.     } else PlaceHolder()
  225.  
  226. #elif DEBUGLEVEL==DEBUGFULL
  227. #define nrequire(assertion, exception)  \
  228.     if (true) {                    \
  229.     void*    __privateAssertion    = (void*)(assertion);     \
  230.                                 \
  231.     if (__privateAssertion) {        \
  232.     dprintf(notrace,    "Assertion \"!(%s [= 0x%08X])\" Failed\n"     \
  233.     "Exception \"%s\" Raised\n"     \
  234.     "File: %s\n"                    \
  235.     "Line: %d",                    \
  236.     "assertion", __privateAssertion, "exception", __FILE__,     \
  237.     __LINE__);                        \
  238.     goto exception;                \
  239.     resumeLabel(exception);        \
  240.     }                                \
  241.     } else PlaceHolder()
  242.  
  243. #else
  244. #define nrequire(assertion, exception)  \
  245.     if (true) {                    \
  246.     if (assertion) {                \
  247.     goto exception;                \
  248.     resumeLabel(exception);        \
  249.     }                                \
  250.     } else PlaceHolder()
  251.  
  252. #endif
  253.  
  254. #if DEBUGLEVEL==DEBUGON
  255. #define require_action(assertion, exception, action)  \
  256.     if (true) {                    \
  257.     if (assertion) ;                \
  258.     else {                            \
  259.     dprintf(notrace,    "Assertion \"%s\" Failed\n"     \
  260.     "Exception \"%s\" Raised",        \
  261.     "assertion", "exception");        \
  262.     { action }                        \
  263.     goto exception;                \
  264.     resumeLabel(exception);        \
  265.     }                                \
  266.     } else PlaceHolder()
  267.  
  268. #elif DEBUGLEVEL==DEBUGFULL
  269. #define require_action(assertion, exception, action)  \
  270.     if (true) {                    \
  271.     if (assertion) ;                \
  272.     else {                            \
  273.     dprintf(notrace,    "Assertion \"%s\" Failed\n"     \
  274.     "Exception \"%s\" Raised\n"     \
  275.     "File: %s\n"                    \
  276.     "Line: %d",                    \
  277.     "assertion", "exception", __FILE__, __LINE__);     \
  278.     { action }                        \
  279.     goto exception;                \
  280.     resumeLabel(exception);        \
  281.     }                                \
  282.     } else PlaceHolder()
  283.  
  284. #else
  285. #define require_action(assertion, exception, action)  \
  286.     if (true) {                    \
  287.     if (assertion) ;                \
  288.     else {                            \
  289.     { action }                        \
  290.     goto exception;                \
  291.     resumeLabel(exception);        \
  292.     }                                \
  293.     } else PlaceHolder()
  294.  
  295. #endif
  296.  
  297. #if DEBUGLEVEL==DEBUGON
  298. #define nrequire_action(assertion, exception, action)  \
  299.     if (true) {                    \
  300.     void*    __privateAssertion    = (void*)(assertion);     \
  301.                                 \
  302.     if (__privateAssertion) {        \
  303.     dprintf(notrace,    "Assertion \"!(%s [= 0x%08X])\" Failed\n"     \
  304.     "Exception \"%s\" Raised",        \
  305.     "assertion", __privateAssertion, "exception");     \
  306.     { action }                        \
  307.     goto exception;                \
  308.     resumeLabel(exception);        \
  309.     }                                \
  310.     } else PlaceHolder()
  311.  
  312. #elif DEBUGLEVEL==DEBUGFULL
  313. #define nrequire_action(assertion, exception, action)  \
  314.     if (true) {                    \
  315.     void*    __privateAssertion    = (void*)(assertion);     \
  316.                                 \
  317.     if (__privateAssertion) {        \
  318.     dprintf(notrace,    "Assertion \"!(%s [= 0x%08X])\" Failed\n"     \
  319.     "Exception \"%s\" Raised\n"     \
  320.     "File: %s\n"                    \
  321.     "Line: %d",                    \
  322.     "assertion", __privateAssertion, "exception", __FILE__,     \
  323.     __LINE__);                        \
  324.     { action }                        \
  325.     goto exception;                \
  326.     resumeLabel(exception);        \
  327.     }                                \
  328.     } else PlaceHolder()
  329.  
  330. #else
  331. #define nrequire_action(assertion, exception, action)  \
  332.     if (true) {                    \
  333.     if (assertion) {                \
  334.     { action }                        \
  335.     goto exception;                \
  336.     resumeLabel(exception);        \
  337.     }                                \
  338.     } else PlaceHolder()
  339.  
  340. #endif
  341.  
  342. #define retry                     \
  343.     if (true) {                    \
  344.     goto start;                    \
  345.     } else PlaceHolder()
  346.  
  347. #define resume(exception)         \
  348.     if (true) {                    \
  349.     goto resume_##exception;        \
  350.     } else PlaceHolder()
  351.  
  352. #endif
  353.  
  354.